route.ts 429 B

123456789101112131415161718
  1. import { markInvoicePaid } from "@/lib/db/store";
  2. export async function POST(
  3. req: Request,
  4. { params }: { params: Promise<{ id: string }> },
  5. ) {
  6. const { id } = await params;
  7. const result = await markInvoicePaid(id);
  8. if (result && "error" in result) {
  9. return Response.json({ error: result.error }, { status: 400 });
  10. }
  11. return Response.json({
  12. message: "Invoice marked as paid",
  13. invoice: result,
  14. });
  15. }